/*
 *主要放置 公共的方法
 */


/**
 *弹窗信息框
 */
function MessageBox($message){
	var artTip = art.dialog({
		id: 'Tips',
		zIndex: 9999,
        padding: '4px',
		title: false,
		cancel: false,
		fixed: true,
		lock: true
	});

	flag = (flag || 'true');
	//默认调用成功
	if(flag == 'error'){
		artTip.content('<div class="promptMsg clearfix"><div class="icon error"></div><div class="msg">' + msg + '</div><div class="clear"></div></div><span class="sd sd-br4"></span>');
	}else if(flag == 'true'){
		artTip.content('<div class="promptMsg clearfix"><div class="icon ok"></div><div class="msg">' + msg + '</div><div class="clear"></div></div><span class="sd sd-br4"></span>');
   	}else if(flag == 'loading'){
		//加载中
        artTip.content('<div class="promptMsg clearfix"><div class="icon loading"></div><div class="msg">' + msg + '</div></div><span class="sd sd-br4"></span>');
	}

	if(time != 0)
		artTip.time((time*1000) || 800);
}
/*
 *信息提示
 *msg 提示信息 (必填)
 *time 默认 2秒 (0 为一直显示)
 *flag [成功][失败](默认调用成功)
 */
function promptMsg(msg,time,flag){

	var artTip = art.dialog({
		id: 'Tips',
		zIndex: 9999,
        padding: '4px',
		title: false,
		cancel: false,
		fixed: true,
		lock: true
	});

	flag = (flag || 'true');
	//默认调用成功
	if(flag == 'error'){
		artTip.content('<div class="promptMsg clearfix"><div class="icon error"></div><div class="msg">' + msg + '</div><div class="clear"></div></div><span class="sd sd-br4"></span>');
	}else if(flag == 'true'){
		artTip.content('<div class="promptMsg clearfix"><div class="icon ok"></div><div class="msg">' + msg + '</div><div class="clear"></div></div><span class="sd sd-br4"></span>');
   	}else if(flag == 'loading'){
		//加载中
        artTip.content('<div class="promptMsg clearfix"><div class="icon loading"></div><div class="msg">' + msg + '</div></div><span class="sd sd-br4"></span>');
	}

	if(time != 0)
		artTip.time((time*1000) || 800);
}

//对ajax的统一 封装

var handler = function(url, p, fn){
    $.post(url, p, function(ans){
		fn(ans);
    }, 'json');
}
